figure.Cooling = new Class({
    Extends: figure.DomFigure,

    initialize: function(id, css, type) {
        this.parent(id);
        this.type = type;
        this.sizes = figure.coolingSizes;
        this.createElement('canvas', {
            id: id,
            Width: 100,
            Height: 100,
            css: css
        });
        this.element = this.getElement();
        this.writeTag(css.top + 1.2 * this.sizes.HEIGHT, css.left - this.sizes.WIDTH +35)
    },

    draw: function() {
        var ctx = this.element[0].getContext('2d');
        var x = 0;
        var y = 0;
        var radius =10;
        height = this.sizes.HEIGHT;
        width= this.sizes.WIDTH;

        ctx.save();
        if(this.type == 'post_ferm'){
            ctx.translate(height,0);
            ctx.rotate(90*Math.PI/180);
        }
        ctx.beginPath();

        ctx.fillStyle = this._createGradient(ctx);
        ctx.moveTo(x + radius, y);
        ctx.lineTo(x + width - radius, y);
        ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
        ctx.lineTo(x + width, y + height - radius);
        ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
        ctx.lineTo(x + radius, y + height);
        ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
        ctx.lineTo(x, y + radius);
        ctx.quadraticCurveTo(x, y, x + radius, y);
        ctx.fill();
        ctx.stroke();

        //rayito
        ctx.save();
        ctx.beginPath();
        ctx.moveTo(0, height/2);
        ctx.lineTo(width/5,height/2);
        ctx.lineTo(2*width/5,2);
        ctx.lineTo(3*width/5,height -2);
        ctx.lineTo(4*width/5,height/2);
        ctx.lineTo(width -1,height/2);
        ctx.stroke();
        ctx.restore();
    },

    _createGradient: function(context) {
        var grd = context.createLinearGradient(10,2,65,10);
        grd.addColorStop(0,"white");
        grd.addColorStop(1, figure.ollaRefrigeranteColor);
        return grd;
    }



});
